package _5_Create._5_1_Factory._5_1_0_SimpleFactory._0_;

public class FruitGardener {

    public static Fruit factory(String which) throws BadFruitException {
        if (which.equals("apple")) {
            return new Apple();
        } else if (which.equals("grape")) {
            return new Grape();
        } else if (which.equals("Strawberry")) {
            return new Strawberry();
        }
        throw new BadFruitException("unknown Fruit:" + which);
    }
}
